一、Read TID via USB
UsbConnection usbConnection = new UsbConnection();//Establish USB connection
if (!usbConnection.Open()) {
    System.out.println("Failed to connect the printer. Please check.");
    return;
}
if(isRFIDwrite)
    tagTID = usbConnection.readUHFTag(0, 3);//Read TID, and then write EPC operation
else
    tagTID=usbConnection.readUHFTag(0,2);//Read TID without writing EPC operation
usbConnection.Close();//Close USB connection


二、Read TID in network mode
if(isRFIDwrite)
    tagTID = zmprintoperate.ReadFromPrinterUHFbyNet(thiszmprinter, 0, false);//Read the TID of the tag, and subsequent write operations
else
    tagTID = zmprintoperate.ReadFromPrinterUHFbyNet(thiszmprinter, 0, true);//Read the TID of the tag without writing EPC
if (tagTID.isEmpty() || tagTID.equals("X"))//No data read
{
    System.out.println("No label data read。");
    zmprintoperate.PrintBlankLabelbyNet(thiszmprinter, thiszmlabel);//Print a blank page to read the next label
    Thread.sleep(3000);
    continue;
}